<template>
  <div class="container">
    <div class="header">
      <div class="headerOne">
        <div class="topOne">
          <div
            class="selection" @click="$router.push('/city')"
          >
            <span>上海</span>
            <van-icon name="arrow-down" />
          </div>
          <div class="inp">
            <van-icon name="search" />
            <span>请输入小区或地址</span>
          </div>
        </div>
        <div class="swiper" >

          <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
              <van-swipe-item v-for="(item,key) in imgList" :key="key">
                <img :src="'http://www.xiaoshuaipeng.com:8080'+item.imgSrc" alt="">
              </van-swipe-item>

          </van-swipe>
        </div>
      </div>
    </div>
    <div class="main">
      <div class="classfiy">
        <div class="kuai">
          <div class="yuan">
            <i>✈</i>
          </div>
          <p>整租</p>
        </div>
        <div class="kuai">
          <div class="yuan">
            <i>✈</i>
          </div>
          <p>整租</p>
        </div>
        <div class="kuai">
          <div class="yuan">
            <i>✈</i>
          </div>
          <p>整租</p>
        </div>
        <div class="kuai">
          <div class="yuan">
            <i>✈</i>
          </div>
          <p>整租</p>
        </div>
      </div>
      <!-- 租房小组 -->
              <p style="height: 40px; line-height: 40px;display: flex; justify-content: space-between;padding: 0 10px;"><span>租房小组</span><span>更多</span></p>
      <van-grid :column-num="2" :gutter="5">

        <van-grid-item v-for="(item,index) in gropList" :key="index">
         <div  class="fd">
          <div>
            <h4>{{ item.title }}</h4>
            <p>{{item.desc}}</p>
          </div>
          <img :src="'http://www.xiaoshuaipeng.com:8080'+item.imgSrc" alt="">
         </div>
        </van-grid-item>
      </van-grid>
      <!-- 资讯 -->
      <div class="information"></div>
      <!-- 内容 -->
      <Inform></Inform>
    </div>
  </div>
</template>

<script>
// import axios from "axios";
import Inform from "@/components/Inform.vue";
import {swiper,grop} from '@/api/user'
export default {
  name: "IndexShou",
  components: {
    Inform,
  },
  data() {
    return {
      imgList: {},
      area: [],
      gropList:[]
    };
  },
 created() {
    // 轮播图
    this.lun();
    // 资讯

  },
  methods: {
    async lun() {
      const res = await swiper()
      this.imgList = res.data.body;
      // console.log(this.imgList)
      const {data} = await grop()
      this.gropList=data.body
    },
  },
};
</script>

<style scoped lang="less">
.header {
  .headerOne {
    position: relative;
    .topOne {
      position: absolute;
      top: 10px;
      left: 10px;
      display: flex;
      height: 30px;
      line-height: 30px;
      padding: 10px;
      z-index: 10;
      .selection {
        background-color: #fff;
      }
      .inp {
        width: 240px;
        background-color: #fff;
      }
    }
    .swiper {
      .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    // line-height: 150px;
    text-align: center;
    // background-color: #39a9ed;
  }

      img {
        width: 100vw !important;
      }
    }
  }
}



.main {
  margin-bottom: 50px;
  .classfiy {
    height: 94px;
    background-color: #fff;
    display: flex;
    justify-content: space-evenly;
    align-content: center;
    .kuai {
      width: 20%;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      align-items: center;
      .yuan {
        width: 48px;
        height: 48px;
        text-align: center;
        line-height: 48px;
        background-color: #24ff74;
        border-radius: 50%;
      }
    }
  }
  .van-grid-item{
    .fd{
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      h4 {
        font-size: 13px;
        margin-bottom: 10px;

      }
      p{
        font-size: 12px;
      }
    }
    img{
      width: 55px;
      margin-left: 10px;

    }
  }
}
</style>
